package com.moonlit.myspring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 * 关羽类
 */
@Component("guanyu")
public class GuanYu implements  Hero {
  //创建一个武器的接口
  @Autowired
  @Qualifier("halberd")
  private Weapon weapon;

  public void perform() {
    System.out.println("Guanyu pick up his weapon.");
    weapon.attack();
  }
}
